/* eslint-disable space-before-function-paren */
/* eslint-disable react/react-in-jsx-scope */
/* eslint-disable eol-last */
import './App.scss'
// App.tsx
// 导入路由
import { Router, Redirect, Route } from 'react-router-dom'

// 导入页面组件
import Login from './pages/Login/Login'
import Layout from './pages/Layout/Layout'
import ProfileEdit from './pages/Profile/Edit'
import { PrivateRoute } from './components/PrivateRoute'
import history from './utils/history'
import Chat from './pages/Profile/Chat/Chat'
import Search from './pages/Search/Search'
import Article from './pages/Article/Article'
import Result from './pages/Search/Result/Result'
import KeepAlive from './components/Keepalive/Keepalive'
// 配置路由规则
function App() {
  return (
    <Router history={history}>
      <div className="app">
        <Route path='/' exact render={() => <Redirect to='/home' />}></Route>
        {/* <Route path='/home' component={Layout}></Route> */}
        <KeepAlive path='/home'>
           <Layout/>
        </KeepAlive>
        <Route path='/login'><Login /></Route>
        {/* <Route path='/profile'><Profile /></Route> */}
        <PrivateRoute path="/profile/edit">
          <ProfileEdit />
        </PrivateRoute>
        <PrivateRoute path="/chat">
          <Chat />
        </PrivateRoute>
        <Route exact path="/search">
           <Search></Search>
       </Route>
       <Route exact path="/article/:id">
           <Article/>
       </Route>
       <Route exact path="/search/result">
           <Result/>
       </Route>
      </div>
    </Router>
  )
}

export default App